home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_kdelibs.idb / usr / freeware / kde / include / htmlframe.h.z / htmlframe.h
Encoding:
C/C++ Source or Header  |  1999-01-26  |  3.5 KB  |  158 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 1997 Martin Jones (mjones@kde.org)
  3.               (C) 1997 Torben Weis (weis@kde.org)
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18.     Boston, MA 02111-1307, USA.
  19. */
  20. #ifndef HTMLFRAME_H
  21. #define HTMLFRAME_H
  22.  
  23. #include <qwidget.h>
  24. #include <qlist.h>
  25. #include <qframe.h>
  26.  
  27. class HTMLFramePanner;
  28. class HTMLFrameSet;
  29. class KHTMLView;
  30.  
  31. class HTMLFramePanner : public QFrame
  32. {
  33.     Q_OBJECT
  34. public:
  35.     enum Orientation { HORIZONTAL = 1, VERTICAL = 2 };
  36.     
  37.     HTMLFramePanner( HTMLFramePanner::Orientation _orientation, QWidget *_parent = 0L, const char *_name = 0L );
  38.     ~HTMLFramePanner();
  39.     
  40.     void setChild1( QWidget *_child ) { child1 = _child; }
  41.     void setChild2( QWidget *_child ) { child2 = _child; }    
  42.  
  43.     void setIsMoveable( bool _move );
  44.  
  45. protected:
  46.     virtual void mousePressEvent( QMouseEvent *_ev );
  47.     virtual void mouseMoveEvent( QMouseEvent *_ev );
  48.     virtual void mouseReleaseEvent( QMouseEvent *_ev );
  49.     
  50.     QWidget *child1;
  51.     QWidget *child2;
  52.  
  53.     int initialX;
  54.     int initialY;
  55.     QPoint initialGlobal;
  56.     
  57.     HTMLFramePanner::Orientation orientation;
  58.  
  59.     bool moveable;
  60. };
  61.  
  62. /**
  63.  * HTML Frame Set
  64.  * @internal
  65.  */
  66. class HTMLFrameSet : public QWidget
  67. {
  68.     Q_OBJECT
  69. public:
  70.     HTMLFrameSet( QWidget *_parent, const char *_src );
  71.     ~HTMLFrameSet();
  72.     
  73.     void append( QWidget *_w );
  74.  
  75.     virtual void parse();
  76.   
  77.     virtual int calcSize( const char *s, int *size, int _max );
  78.  
  79.     KHTMLView* getSelectedFrame();
  80.  
  81.     /**
  82.      * @return TRUE if the user is allowed to resize the frame set.
  83.      *
  84.      * @see #bAllowResize
  85.      */
  86.     bool getAllowResize() { return bAllowResize; }
  87.     /**
  88.      * @return the width of the frames border ( read: @ref HTMLFramePanner ) in pixels
  89.      *         or -1 for the default width.
  90.      */
  91.     int getFrameBorder() { return frameBorder; }
  92.   
  93. protected:
  94.     virtual void resizeEvent( QResizeEvent* _ev );
  95.     
  96.     QList<QWidget> widgetList;
  97.  
  98.     HTMLFramePanner::Orientation orientation;
  99.  
  100.     QString cols;
  101.     QString rows;
  102.     
  103.     /**
  104.      * Array that holds the layout information for all embedded frames.
  105.      */
  106.     int *size;
  107.     /**
  108.      * Amount of frames as mentioned in the COLS or ROWS tag.
  109.      */
  110.     int elements;
  111.  
  112.     /**
  113.      * The amount of frames we parsed until now.
  114.      */
  115.     int cFrames;
  116.  
  117.     /**
  118.      * The amount of pixels used for the frames border ( read @ref HTMLFramePanner ).
  119.      * A value of -1 indicates the default.
  120.      */
  121.     int frameBorder;
  122.   
  123.     /**
  124.      * This flags is usually TRUE. But if we have the <frame noresize> tag, 
  125.      * this flag is set to FALSE to indicate that the user may not resize this frame set.
  126.      */
  127.     bool bAllowResize;
  128.  
  129.     /**
  130.      * This is the last panner added to the widgetList. This variable is used
  131.      * during parsing only.
  132.      */
  133.     HTMLFramePanner *lastPanner;
  134. };
  135.  
  136.  
  137.  
  138. #endif
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.